package com.labichaoka.chaoka.ui.home.fragment.my.set.info;

import com.labichaoka.chaoka.entity.PersonInfoResponse;

/**
 * Created by ruan on 2018/8/9.
 */

public class PersonInfoDisplayPresenterImpl implements PersonInfoDisplayPresenter,PersonInfoDisplayInteractor.OnGetPersonInfoFinishedListener {
    private PersonInfoDisplayView displayView;
    private PersonInfoDisplayInteractor displayInteractor;

    public PersonInfoDisplayPresenterImpl(PersonInfoDisplayView displayView, PersonInfoDisplayInteractor displayInteractor) {
        this.displayView = displayView;
        this.displayInteractor = displayInteractor;
    }

    @Override
    public void getPersonInfo() {
        if (displayView!=null){
            displayView.showProgress();
        }
        displayInteractor.getPersonInfo(this);
    }

    @Override
    public void onDestroy() {
        displayView=null;
    }

    @Override
    public void onSuccessed(PersonInfoResponse response) {
        displayView.hideProgress();
        displayView.setUI(response);
    }

    @Override
    public void onFailed() {
        displayView.hideProgress();
    }
}
